package com.gm.wholesale.module.order.api;

import android.util.ArrayMap;

import com.gm.commonlib.base.baseBean.BaseListResp;
import com.gm.commonlib.base.baseBean.BasePageData;
import com.gm.commonlib.base.baseBean.BaseResp;
import com.gm.commonlib.base.baseBean.DataResp;
import com.gm.wholesale.module.aftersale.bean.AftersalesBean;
import com.gm.wholesale.module.order.bean.CreateAftersaleReq;
import com.gm.wholesale.module.order.bean.CreateOrderBean;
import com.gm.wholesale.module.order.bean.OrderBean;
import com.gm.wholesale.module.order.bean.OrderDetailBean;
import com.gm.wholesale.module.order.bean.OrderRecmPriceBean;
import com.gm.wholesale.module.order.bean.ReviceMoneyReq;
import com.gm.wholesale.module.order.bean.needorder.AcceptOrderIdsReq;
import com.gm.wholesale.module.order.bean.needorder.AddReceipBean;
import com.gm.wholesale.module.order.bean.needorder.NeedOrderBean;
import com.gm.wholesale.module.order.bean.needorder.NeedOrderChangeBean;
import com.gm.wholesale.module.order.bean.needorder.NeedOrderDetailBean;

import io.reactivex.Observable;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;

public interface IOrderApi {
    //创建订单
    @POST("pda/api/v1/order/onsite")
    Observable<BaseResp> createOrder(@Body CreateOrderBean data);


    @PUT("pda/api/v1/order/onsite/{orderId}")
    Observable<BaseResp> updateOrder(@Path("orderId") long orderId,@Body CreateOrderBean createOrderBean);


    //todo 获取订单列表
    @POST("pda/api/v1/order/list")
    Observable<BasePageData<OrderBean>> getOrderList(@Body ArrayMap<String,Object> data);

    //todo 获取常用的价格
    @GET("pda/api/v1/order/price")
    Observable<DataResp<OrderRecmPriceBean>> getOrderPrice(@QueryMap ArrayMap<String,Object> data);

    // todo 获取订单详情
    @GET("pda/api/v1/order/detail/{orderID}")
    Observable<DataResp<OrderDetailBean>> getOrderDetail(@Path("orderID") long orderID);

    //收款
    @POST("pda/api/v1/order/pay")
    Observable<BaseResp> orderToPay(@Body ReviceMoneyReq data);


    //创建售后单
    @POST("pda/api/v1/aftersale/order/{orderId}")
    Observable<BaseResp> createAftersale(@Path("orderId") long orderId,@Body CreateAftersaleReq data);



    @PUT("pda/api/v1/order/{orderId}/aftersale/{aftersaleId}")
    Observable<BaseResp> refund(@Path("orderId") long orderId,@Path("aftersaleId") long aftersaleId,@Body ArrayMap<String,Object> data);


   //todo 需求单子

    //todo 获取需求单子列表
    @POST("pda/api/v1/needs/list")
    Observable<BasePageData<NeedOrderBean>> getNeedOrderList(@Body ArrayMap<String,Object> data);


    //todo 获取订单对应的售后列表数据
    @GET("pda/api/v1/aftersale/order/{id}")
    Observable<BaseListResp<AftersalesBean>> getAfterSalesBeans(@Path("id") long id);



    //获取未接单数量
    @GET("pda/api/v1/needs/stats/unordered")
    Observable<DataResp<Long>> getUnReviceOrder(@QueryMap ArrayMap<String,Object> quearyData);


    //接单
    @PUT("pda/api/v1/needs/accept/{needsID}")
    Observable<BaseResp> acceptOrder(@Path("needsID") long needsID,@Query("version") int version);

    //打印后，批量接单操作
    @PUT("pda/api/v1/needs/accepts")
    Observable<BaseResp> acceptOrders(@Body AcceptOrderIdsReq data);


    //完成分拣|截单
    @PUT("pda/api/v1/needs/complete/{needsID}")
    Observable<BaseResp> finishNeedOrder(@Path("needsID") long needsID,@Query("version") int version);


    //知晓变更
    @PUT("pda/api/v1/needs/changed/{needsID}")
    Observable<BaseResp> knowOrder(@Path("needsID") long needsID,@Query("version") long version);


    //添加or修改回执
    @POST("/pda/api/v1/needs/receipt/{needsID}")
    Observable<BaseResp> addReceipt(@Path("needsID") long needsID,@Body AddReceipBean addReceipBean);


    //获取订单详情
    @GET("pda/api/v1/needs/detail/{needsID}")
    Observable<DataResp<NeedOrderDetailBean>> getNeedOrderDetail(@Path("needsID") long needsID);


    //获取变更记录
    @GET("pda/api/v1/needs/changed/{needsID}")
    Observable<DataResp<NeedOrderChangeBean>> getNeedOrderChange(@Path("needsID") long needsID);


    //订单标记支付
    @PUT("/pda/api/v1/settlement/customer/order_pay/{order_id}")
    Observable<BaseResp> payMoney(@Path("order_id") long order_id,@Body  ArrayMap<String,Object> data);



}
